const ajax = (url, method, data) => {
  const base_url = 'http://localhost:3000';

  return new Promise((resolve, reject) => {
    wx.request({
      url: `${base_url}${url}`,
      method: method ? method : 'POST',
      data,
      success: (res) => {
        resolve(res);
      },
      fail: (err) => {
        reject(err);
      }
    })
  })
};

module.exports = {
  ajax
}